package gameA;


import org.tmatesoft.svn.core.SVNException;

import resultPackage.Connector;
import resultPackage.ResultRecord;

public class MyGameA {

	static String url;
	static String login;
	static String password;


	/**
	 * @param args
	 * @throws SVNException 
	 */
	public static void main(String[] args) throws SVNException {
		
		// intialise connection details
		// TODO - load from file held on remote server
		// TODO - interface to edit the connection details 
		login = "arthurglewis@gmail.com";
	    password = "yU3YK9tx2ra6";
	    url = "https://my-msc-project-2013.googlecode.com/svn/";
		ResultRecord resRec = new ResultRecord();

		playGame();
		saveResults(resRec);
		writeResult();
		
	}
	
	static void playGame(){
		// main application code here
		System.out.println("WELCOME TO MY NEW GAME");
		System.out.println("******************");
		System.out.println("GAME OVER");

		
	}
	
	/* 
	 * accepts a populated result record (array of Indicators) 
	 * Writes to the result file
	 */
	static void saveResults(ResultRecord resRec){
		//initialise data type names
		System.out.println("result set in result record"+resRec.getResultRec());

	}
	
	// checks out file  and writes saved result
	static void writeResult() throws SVNException{
		// processing game results to send result to file
		//TODO - READ URL FROM A FILE or user can enter URL
	
		Connector myConn = new Connector();
		myConn.login(login,password,url);
		
		myConn.checkOut();

		System.out.println("Writing to file");
		
		myConn.update();
		
		myConn.commit();
	}

}	